    /*  
    championBuilder - Champions Online character planner.
    Copyright (C) 2009 Moritz Hartmeier
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You can find the GNU General Public License in the data folder.
    */


package ch.zarzu.util;

import java.awt.*;

import javax.swing.*;
import javax.swing.plaf.metal.*;


public class CustomHorizontalScrollBarUI extends MetalScrollBarUI {
    protected void paintThumb(final Graphics g, final JComponent c, final Rectangle thumbBounds) {
        int x = thumbBounds.x;
        int y = thumbBounds.y;
        int w = thumbBounds.width;
        int h = thumbBounds.height - 1;
        g.setColor(new Color(25, 96, 178));
        g.fillRect(x, y, w, h);
        
        g.setColor(Color.BLACK);
        g.fillRect(x, y, 2, h);
        g.fillRect(x + w - 2, y, 2, h);
        g.fillRect(x, y, w, 2);
        g.fillRect(x, y + h - 2, w, 2);
        
        g.setColor(Color.WHITE);
        g.fillRect(x + w/2 - 4, y + 4, 2, h - 8);
        g.fillRect(x + w/2 -1, y + 4, 2, h - 8);
        g.fillRect(x + w/2 + 2, y + 4, 2, h - 8);
        
    }
    
    protected void paintTrack(final Graphics g, final JComponent c, final Rectangle trackBounds) {
        Graphics2D g2 = (Graphics2D)g;
        int x = trackBounds.x;
        int y = trackBounds.y + 2;
        int w = trackBounds.width;
        int h = trackBounds.height - 5;
        g.setColor(new Color(47, 56, 63));
        g.fillRect(x, y, w, h);
        g.setColor(Color.BLACK);
        g.fillRect(x, y, w, 2);
        g.fillRect(x, y + h - 2, w, 2);
        
        for(int i = 0; i < w; i += 5) {
            g.drawLine(x + i, y, x + i, y + h -2);
        }
    }
    
    protected JButton createDecreaseButton(int orientation) {
        JButton button = new JButton(new ImageIcon(AppPath.get() + "images/scrollbar/left.png"));
        button.setPreferredSize(new Dimension(16, 16));
        button.setBorderPainted(false);
        button.setFocusable(false);
        button.setContentAreaFilled(false);
        return button;
    }
    
    protected JButton createIncreaseButton(int orientation) {
        JButton button = new JButton(new ImageIcon(AppPath.get() + "images/scrollbar/right.png"));
        button.setPreferredSize(new Dimension(16, 16));
        button.setBorderPainted(false);
        button.setFocusable(false);
        button.setContentAreaFilled(false);
        return button;
    }
}
